import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { ObjCreate } from "../../common/ObjCreate";
import { BossFieldTopData } from "../cellData/BossFieldTopData";
import { ColorConfig } from "../../../resource/ColorConfig";
import { Cache } from "../../../cache/Cache";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { Language } from "../../../../../extend/language/Language";
import { GameMapUtil } from "../../../scene/map/GameMapUtil";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
//class BossFieldScoreCellRenderer
    
    export  class BossFieldScoreCellRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._line = ResouceConst.getScaleBitmap("SplitLine");
            this._line.width = 700;
            this._line.height = 2;
            this.addChild(this._line);
            var loc1=new GTextFormat(FontUtil.songtiName, 12, 11661311);
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._tfRank = ObjCreate.createTextField("", 0, 6, 50, 20, this, loc1);
            this._tfName = ObjCreate.createTextField("", 45, 6, 180, 20, this, loc1);
            this._tfCamp = ObjCreate.createTextField("", 210, 6, 60, 20, this, loc1);
            this._tfKillUser = ObjCreate.createTextField("", 270, 6, 60, 20, this, loc1);
            this._tfAssists = ObjCreate.createTextField("", 330, 6, 60, 20, this, loc1);
            this._tfFightHonor = ObjCreate.createTextField("", 390, 6, 60, 20, this, loc1);
            this._tfTaskHonour = ObjCreate.createTextField("", 450, 6, 60, 20, this, loc1);
            this._tfResultHonor = ObjCreate.createTextField("", 510, 6, 60, 20, this, loc1);
            this._tfCliffordHonor = ObjCreate.createTextField("", 570, 6, 60, 20, this, loc1);
            this._tfTotleHonor = ObjCreate.createTextField("", 630, 6, 60, 20, this, loc1);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "bossfieldtopdata") 
            {
                this._topData = arg1 as BossFieldTopData;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            var loc1=new GTextFormat(FontUtil.songtiName, 12, ColorConfig.instance.getCampColor(this._topData.playerScore.force).intColor);
            this._tfRank.text = this._topData.rank.toString();
            if (Cache.instance.bossField.isCrossBossField) 
            {
                if (EntityUtil.isSameServerByRole(this._topData.playerScore.entityId)) 
                {
                    this._tfName.text = Language.getString(70801) + " " + this._topData.playerScore.name;
                }
                else 
                {
                    this._tfName.text = "[" + EntityUtil.getProxyName(this._topData.playerScore.entityId) + "]" + " " + this._topData.playerScore.name;
                }
            }
            else 
            {
                this._tfName.text = this._topData.playerScore.name;
            }
            this._tfKillUser.text = this._topData.playerScore.killPlayer.toString();
            this._tfAssists.text = this._topData.playerScore.assist.toString();
            this._tfFightHonor.text = this._topData.playerScore.fightHonour.toString();
            this._tfTaskHonour.text = this._topData.playerScore.taskHonour.toString();
            this._tfResultHonor.text = this._topData.playerScore.finalHonour.toString();
            this._tfCliffordHonor.text = this._topData.playerScore.inspireHonour.toString();
            this._tfTotleHonor.text = this._topData.playerScore.honour.toString();
            if (Cache.instance.bossField.isCrossBossField || GameMapUtil.curMapState.isCrossBossField) 
            {
                this._tfCamp.text = GameDefConfig.instance.getCrossBossFieldName(this._topData.playerScore.force);
            }
            else 
            {
                this._tfCamp.text = GameDefConfig.instance.getBossFieldShort(this._topData.playerScore.force).name;
            }
            this._tfCamp.setTextFormat(loc1);
            return;
        }

        /* internal */ /* var */_line: ScaleBitmap;

        /* internal */ /* var */_tfRank: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfName: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfCamp: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfKillUser: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfAssists: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfFightHonor: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfTaskHonour: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfResultHonor: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfCliffordHonor: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfTotleHonor: Object /* flash.text.TextField */;

        /* internal */ /* var */_topData: BossFieldTopData;
    }
